package com.x.core.utils;

import cn.hutool.core.comparator.CompareUtil;
import org.springframework.util.StringUtils;

public class CompareUtils {

    public static boolean gtZero(Long value){
        return CompareUtil.compare(value, 0L) > 0;
    }

    public static boolean gtZero(Integer value){
        return CompareUtil.compare(value, 0) > 0;
    }

    public static <T> Boolean isEmptyOrZero(T value){
        if (value == null){
            return false;
        }
        if (value instanceof String){
            return StringUtils.isEmpty(value);
        }
        if (value instanceof Long){
            return gtZero((Long) value);
        }
        if (value instanceof Integer){
            return gtZero((Integer) value);
        }
        throw new IllegalStateException(String.valueOf(value));
    }

}
